<details>
<summary>Example Tasks Entity</summary>
```typescript
import { Entity } from "electrodb";

const table = "your_table_name";

const tasks = new Entity({
model: {
entity: "tasks",
version: "1",
service: "taskapp"
},
attributes: {
team: {
type: "string",
required: true
},
task: {
type: "string",
required: true
},
project: {
type: "string",
required: true
},
user: {
type: "string",
required: true
},
title: {
type: "string",
required: true,
},
description: {
type: "string"
},
status: {
// use an array to type an enum
type: ["open", "in-progress", "on-hold", "closed"] as const,
default: "open"
},
points: {
type: "number",
},
tags: {
type: "set",
items: "string"
},
comments: {
type: "list",
items: {
type: "map",
properties: {
user: {
type: "string"
},
body: {
type: "string"
}
}
}
},
closed: {
type: "string",
validate: /[0-9]{4}-[0-9]{2}-[0-9]{2}/,
},
createdAt: {
type: "number",
default: () => Date.now(),
// cannot be modified after created
readOnly: true
},
updatedAt: {
type: "number",
// watch for changes to any attribute
watch: "\*",
// set current timestamp when updated
set: () => Date.now(),
readOnly: true
}
},
indexes: {
projects: {
pk: {
field: "pk",
composite: ["team"]
},
sk: {
field: "sk",
// create composite keys for partial sort key queries
composite: ["project", "task"]
}
},
assigned: {
// collections allow for queries across multiple entities
collection: "assignments",
index: "gsi1pk-gsi1sk-index",
pk: {
// map to your GSI Hash/Partition key
field: "gsi1pk",
composite: ["user"]
},
sk: {
// map to your GSI Range/Sort key
field: "gsi1sk",
composite: ["status"]
}
},
backlog: {
// map to the GSI name on your DynamoDB table
index: "gsi2pk-gsi2sk-index",
pk: {
field: "gsi2pk",
composite: ["project"]
},
sk: {
field: "gsi2sk",
composite: ["team", "closed"],
}
}
}
}, { table });

```
</details>
```
